package com.xingda.packing.dmss.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * 工字轮类型
 */
public enum WheelType {
    B60(1, "B60", 1),
    B80(2, "B80", 2),
    B40(3, "B40", 1),
    B85(4, "B80/17", 2),
    OTHER(5, "", 3);

    /**
     * 根据工字轮类型名称获得工字轮类型
     */
    public static WheelType getByTypeName(String typeName) {
        for (WheelType type : WheelType.values()) {
            if (Objects.nonNull(typeName) && typeName.equals(type.getTypeName())) {
                return type;
            }
        }
        return OTHER;
    }

    /**
     * 根据工字轮类型id获得工字轮类型
     */
    public static WheelType getByTypeId(int typeId) {
        for (WheelType type : WheelType.values()) {
            if (type.getTypeId() == typeId) {
                return type;
            }
        }
        return null;
    }


    WheelType(int typeId, String typeName, int type) {
        this.typeId = typeId;
        this.typeName = typeName;
        this.type = type;
    }

    @Getter
    private final int typeId;

    @Getter
    private final String typeName;
    @Getter
    private final int type;

}
